package xyz.chaobei.date;

import java.time.LocalDate;
import java.time.temporal.ChronoUnit;

/**
 * @author <a href='mailto:maruichao52@gmail.com'>MRC</a>
 * @since 2021/2/19
 */
public class LocalDateTest {

    public static void main(String[] args) {

        LocalDate localDate = LocalDate.now();
        System.out.println("1: 当前日期=" + localDate.toString());

        LocalDate tomorrow = localDate.plus(1, ChronoUnit.DAYS);
        System.out.println("2: 明天日期=" + tomorrow.toString());

        LocalDate yesterday = localDate.minusDays(1);
        System.out.println("3: 昨天日期=" + yesterday.toString());

        LocalDate now = LocalDate.of(2021, 2, 19);
        System.out.println("4: 手动指定=" + now.toString());

        System.out.println("5: 年 getYear=" + now.getYear());
        System.out.println("5: 年 getDayOfYear=" + now.getDayOfYear());

        System.out.println("6: 月 getMonthValue=" + now.getMonthValue());

        System.out.println("7: 月 getDayOfMonth=" + now.getDayOfMonth());
        System.out.println("7: 月 getDayOfWeek=" + now.getDayOfWeek());
    }
}
